<template>
  <div class="app-container">
    <el-form label-width="120px">
      <el-form-item label="名称">
        <el-input v-model="studentObject.name" />
      </el-form-item>
      <el-form-item label="密码">
        <el-input v-model="studentObject.password" />
      </el-form-item>
      <el-form-item label="手机号">
        <el-input v-model="studentObject.phone" :rows="5" type="textarea" />
      </el-form-item>

       <el-form-item>
            <el-button :disabled="isAdd" type="primary" @click="save">保存</el-button>
            <el-button :disabled="isEdit" type="success" @click="update">更新</el-button>
        </el-form-item>
    </el-form>
  </div>
</template>
<script>
import studentApi from '@/api/student'

export default {
  data() {
    return {
      studentObject: {
          name:'',
          password:'',
          phone: ''
      },
      isEdit: false, // 是审核时所有输入框处于禁用状态,默认是true，即禁用
      isAdd: false, // 保存按钮是否禁用,
      BASE_API: process.env.BASE_API, // 获取dev.env.js里面地址
    }
  },
  created() { // 页面渲染之前执行
    
  },
  methods: {
    save() {
      studentApi.add(this.studentObject)
        .then(response => {
          this.studentObject = response.data
        })
    },
    update(stu){
        
    }
  }
}
</script>
